package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

@Repository
public interface BrandMapper extends Mapper<Brand> {

    /**
     *根据分类名称查询品牌名称集合
     * @param category
     * @return
     */
    @Select("SELECT \n" +
            "t3.name,t3.image\n" +
            "FROM \t\t\n" +
            "tb_category t1\n" +
            "INNER JOIN\n" +
            "`tb_category_brand` t2\n" +
            "ON t1.`id`=t2.`category_id`\n" +
            "INNER JOIN \t\n" +
            "tb_brand t3\n" +
            "ON t3.`id`=t2.`brand_id`\n" +
            "WHERE t1.`name`= #{category}\n")
    List<Map> findBrandListByCategory (@Param("category") String category);



}
